﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeiXinSDK.MP.Model
{
	public class AccessTokenModel : ResponseModel
	{
		public AccessTokenModel()
		{
			CreateTime = DateTime.Now;
		}

		[JsonProperty("access_token")]
		public string AccessToken { get; private set; }

		private DateTime CreateTime { get; set; }

		[JsonProperty("expires_in")]
		private int ExpiresIn { get; set; }

		[JsonIgnore]
		public DateTime ExpirationTime { get { return CreateTime.AddSeconds(ExpiresIn - 60); } }

		[JsonIgnore]
		public bool TimeOut { get { return ExpirationTime < DateTime.Now; } }
		

	}
}
